package com.example.test.dialogfactory.factory;

import io.reactivex.rxjava3.core.Observable;
import java.util.ArrayList;
import java.util.List;

public class DataFactory {

    public Observable< List< String > > createPageData( int page, int pageSize ) {

        List< String > data = new ArrayList<>();
        for ( int i = 0; i < pageSize; i++ ) {
            data.add( "page:" + page + " 数据:" + i );
        }

        return Observable.just( data );
    }

    public Observable< List< String > > createJustOnePageData( int page, int pageSize ) {

        if ( page == 1 ) {
            List< String > data = new ArrayList<>();
            for ( int i = 0; i < pageSize - 5; i++ ) {
                data.add( "page:" + page + " 数据:" + i );
            }
            return Observable.just( data );
        } else {
            return Observable.just( new ArrayList<>() );
        }
    }
}
